package com.woniu.p2p.behindServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.p2p.behindService.AnnounceService;
import com.woniu.p2p.entity.Show;
import com.woniu.p2p.mapper.ShowMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * AnnounceServiceImpl
 *
 * @author 郭耀文
 * @date 2020/8/13
 */
@Service
public class AnnounceServiceImpl implements AnnounceService {

    @Autowired
    ShowMapper showMapper;

    @Override
    public PageInfo<Show> selectByName(String name, Integer start) {
        PageHelper.startPage(start,3);
        List<Show> list = showMapper.findByName(name);
        PageInfo<Show> pageInfo=new PageInfo<>(list);
        return pageInfo;
    }

    //添加网页公告
    @Override
    public int addAnnounce(Show announce) {
        return showMapper.insert(announce);
    }

    @Override
    public int delectAnnounce(Integer announceId) {
        return showMapper.deleteByPrimaryKey(announceId);
    }

    @Override
    public int updateAnnounce(Show announce) {
        return showMapper.updateByPrimaryKey(announce);
    }
}
